<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            margin: 0;
            overflow: overlay;
        }
        ::-webkit-scrollbar{
            background-color: transparent;
            width: 12px;
        }
        ::-webkit-scrollbar-thumb{
            background-color: transparent;
            border-radius: 8px;
            background-clip: content-box;
            border: 2px solid transparent;
        }
        body[scroll]::-webkit-scrollbar-thumb,
        ::-webkit-scrollbar-thumb:hover{
            background-color: rgba(0,0,0,.5);
        }
        div{
            height: 300px;
        }
        .bg1{
            background-color: aquamarine;
        }
        .bg2{
            background-color: bisque;
        }
        .bg3{
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class="bg1">我是占位的</div>
    <div class="bg2">我是占位的</div>
    <div class="bg3">我是占位的</div>
    <script>
        window.addEventListener('scroll', function(ev) {
            document.body.toggleAttribute('scroll', true)
            this.timer && clearTimeout(this.timer)
            this.timer = setTimeout(() => {
                document.body.toggleAttribute('scroll')
            }, 500)
        })
    </script>
</body>
</html>